package com.example.mobile2032021606168xmy0421homework;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private RecyclerView rvMainCar;
    private List<Car> list =new ArrayList();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        list.add(new Car("轿车车型生产环节1","轿车汽车放置底盘"));
        list.add(new Car("轿车车型生产环节2","轿车汽车左前悬挂"));
        list.add(new Car("轿车车型生产环节3","轿车汽车右前悬挂"));
        list.add(new Car("轿车车型生产环节4","轿车汽车左后悬挂"));
        list.add(new Car("轿车车型生产环节5","轿车汽车右后悬挂"));
        list.add(new Car("轿车车型生产环节6","轿车汽车固定车架"));
        list.add(new Car("轿车车型生产环节7","轿车汽车发动机"));
        list.add(new Car("轿车车型生产环节8","轿车汽车椅子"));
        list.add(new Car("轿车车型生产环节9","轿车汽车方向盘"));
        list.add(new Car("轿车车型生产环节10","轿车汽车左前车门"));
        list.add(new Car("轿车车型生产环节11","轿车汽车右前车门"));
        list.add(new Car("轿车车型生产环节12","轿车汽车左后车门"));
        list.add(new Car("轿车车型生产环节13","轿车汽车右后车门"));
        list.add(new Car("轿车车型生产环节14","轿车汽车引擎盖"));
        list.add(new Car("轿车车型生产环节15","轿车汽车前挡风玻璃"));
        list.add(new Car("轿车车型生产环节16","轿车汽车后挡风玻璃"));
        list.add(new Car("轿车车型生产环节17","轿车汽车左前轮胎"));
        list.add(new Car("轿车车型生产环节18","轿车汽车右前轮胎"));
        list.add(new Car("轿车车型生产环节19","轿车汽车左后轮胎"));
        list.add(new Car("轿车车型生产环节20","轿车汽车右后轮胎"));

        rvMainCar.setLayoutManager(new LinearLayoutManager(this));
        rvMainCar.setAdapter(new CarRViewAdapter(list));

    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        rvMainCar = (RecyclerView) findViewById(R.id.rv_main_car);
    }
}